package com.qinhailin.portal.business.ctrl;

import com.jfinal.aop.Inject;
import com.jfinal.core.Path;
import com.jfinal.plugin.activerecord.Record;

import com.qinhailin.common.base.BaseController;
import com.qinhailin.common.vo.Grid;
import com.qinhailin.portal.business.model.IWarningList;
import com.qinhailin.portal.business.service.IWarningListService;

/**
 * 
 * @author qinhailin
 * @date 2024-12-13
 */
@Path("/portal/business/iWarningList")
public class IWarningListController extends BaseController {

    @Inject
    IWarningListService service;

  	public void index(){
    	render("index.html");
  	}

    public void list() {
        Record record=getAllParamsToRecord();
        int pageNumber=getParaToInt("pageNumber", 1);
        int pageSize=getParaToInt("pageSize", 10);
        Grid g=service.page(pageNumber, pageSize,record);
        renderJson(g);
	}

    public void add() {
    	render("add.html");
    }

    public void save() {
        IWarningList entity=getBean(IWarningList.class);
    	entity.setId(createUUID());
    	entity.save();
    	setAttr("iWarningList", entity);
    	render("add.html");
    }

    public void edit() {
        setAttr("iWarningList", service.findById(getPara(0)));
        render("edit.html");
    }

    public void update() {
        IWarningList entity=getBean(IWarningList.class);
        entity.update();
        setAttr("iWarningList", entity);
        render("edit.html");
    }

    public void delete() {
        service.deleteByIds(getIds());
        renderJson(suc());
    }

}
